<template>
	<div class="goods-item" @click="$router.push('/goods-detail?gid=' + item.gid)">
		<div class="img-box">
			<img v-lazy="item.pic" alt=""/>
			<div class="mask">
				<div class="circular-wrap">
					<div class="circular-inner">已抢完</div>
				</div>
			</div>
		</div>
		<div class="goods-content">
			<p class="goods-name">{{ item.title }}</p>
			<div class="coupon disabled" @click.stop="">领{{ item.couponMoney }}元券+买后返{{ item.allowanceMoney }}元</div>
			<div class="info">
				<p class="num"><i class="iconfont icon-remenwenti"></i>还剩2340件</p>
				<div class="price">
					<p class="original">{{ item.shoptype === 0 ? '淘宝' : '天猫'}}价¥{{ item.price | fixed(2) }}</p>
					<p class="deal">到手价<span class="symbol">¥</span><span>0</span></p>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
export default {
	name: 'GoodsItem',
	props: {
		item: {
			type: Object
		}
	}
};
</script>

<style lang="scss" scoped>
.goods-item {
	display: flex;
	.img-box {
		width: 240px;
		height: 240px;
		margin-right: 14px;
		position: relative;
		border-radius: 20px;
		overflow: hidden;
		img {
			max-width: 100%;
			max-height: 100%;
		}
		.mask {
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			background: rgba(0, 0, 0, 0.2);
			@include flexBox(center, center);
			.circular-wrap {
				width: 110px;
				height: 110px;
				border-radius: 50%;
				background: rgba(0, 0, 0, 0.3);
				transform: rotate(-24deg);
				@include flexBox(center, center);
				.circular-inner {
					width: 90px;
					height: 86px;
					border: 2px solid $color-white;
					border-radius: 50%;
					font-size: 18px;
					color: $color-white;
					@include flexBox(center, center);
				}
			}
		}
	}
	.goods-content {
		height: 240px;
		flex: 1;
		@include flexBox(space-between, null, column);
		.goods-name {
			text-align: left;
			color: $text-black;
			font-size: 28px;
			@include ellipsis(2);
		}
		.coupon {
			width: fit-content;
			background: linear-gradient(#ff484a, #ff5049);
			line-height: 54px;
			padding: 0 20px;
			border-radius: 50px;
			color: $color-white;
			font-size: 24px;
			margin-top: 10px;
			transition: 0.3s;
			&.disabled {
				background: #ebebeb;
				color: #7b7b7b;
			}
		}
		.info {
			@include flexBox(space-between, flex-end);
			.num {
				color: $main-color;
				font-size: 28px;
				i {
					color: #f42e39;
					margin-right: 6px;
				}
			}
			.price {
				text-align: right;
				.original {
					color: #b5b5b5;
					font-size: 24px;
					text-align: right;
				}
				.deal {
					font-size: 28px;
					color: $color-black;
					.symbol {
						font-size: 26px;
					}
					span {
						font-weight: 600;
						color: $main-color;
						font-size: 32px;
					}
				}
			}
		}
	}
}
</style>
